package org.example;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Configuration
@ComponentScan(basePackages = "org.example.bean")
public class AppConfig2 {

    @Bean
    public Executor threadPool() {
        Executor executor = new ThreadPoolExecutor(10, 20, 10,TimeUnit.SECONDS, new ArrayBlockingQueue<>(10));
        return executor;
    }
}
